package com.tedu.basic.homework;
import java.util.Arrays;
import java.util.Random;

public class work2 {
    public static void main(String[] args) {
        max();
    }

    public static void f() {
        char[] arr={'h','e','l','l','o'};
        //循环
        char[] a=new char[5];
        for (int i = 0; i <arr.length; i++) {
            a[i]=arr[i];
        }
        System.out.println(a);
        //copy
        char[] b=Arrays.copyOf(arr,arr.length);
        System.out.println(b);
        //copy
        char[] c=new char[5];
        System.arraycopy(arr,0,c,0,arr.length);
        System.out.println(c);
    }

    public static void max() {
        int[] a=new int[10];
        for (int i = 0; i <10; i++) {
            a[i]=new Random().nextInt(100);
        }
        System.out.println(Arrays.toString(a));
        int max=0;
        for (int i = 0; i <a.length-1; i++) {
            if(a[i]>a[i+1]){
                max=a[i];
                a[i+1]=a[i];
            }else {
                max=a[i+1];
            }
        }
        System.out.println("最大为： "+max);
    }

    public static void prinnt(){
        int[] x={1,2,3,4,5};printfo(x);//一
        System.out.println();
        double[] y={2.1,3.3,1.0,2.0};printfo(y);//二
        System.out.println();
        char[] z={'j','a','v','a','!'};printfo(z);//三

    }
    public static void printfo(int[] a){
        for (int i = 0; i <a.length; i++) {
            System.out.print(a[i]+" ");
        }
    }
    public static void printfo(double[] a){
        for (int i = 0; i <a.length; i++) {
            System.out.print(a[i]+" ");
        }
    }
    public static void printfo(char[] a){
        for (int i = 0; i <a.length; i++) {
            System.out.print(a[i]+" ");
        }
    }


}
